<%--
  Created by IntelliJ IDEA.
  User: limin
  Date: 2021/8/10
  Time: 20:41
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ page import="com.dao.GoodsDao" %>
<%@ page import="com.beans.GoodsInfo" %>
<%@ page import="com.beans.CateInfo" %>
<%@ page import="com.dao.CateDao" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<!DOCTYPE HTML>
<html>
<head>
    <base href="<%=basePath%>">

    <title></title>

    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">

    <link rel="stylesheet" type="text/css" href="css/maintable.css" >
    <link rel="stylesheet" type="text/css" href="css/edittable.css"  >
    <link rel="stylesheet" type="text/css" href="css/validate.css"  >
    <script type="text/javascript"  src="js/jquery-1.8.0.js"></script>
    <script>
        $(function(){
            $("input[type=text],textarea").focus(function(){
                $(this).addClass("input_focus");
            }).blur(function(){
                $(this).removeClass("input_focus");
            });

            $(".form_btn").hover(function(){
                    $(this).css("color","red").css("background","#6FB2DB");
                },

                function(){
                    $(this).css("color","#295568").css("background","#BAD9E3");
                });
        });
    </script>
</head>
<%
    GoodsDao goodsDao = new GoodsDao();
    CateDao cateDao = new CateDao();
    int id = Integer.parseInt(request.getParameter("id"));
    GoodsInfo goodsInfo = goodsDao.getGoodsById(id);
    CateInfo bigCateInfo = cateDao.getCateInfoById(goodsInfo.getBigCateId());
    CateInfo smallCateInfo = cateDao.getCateInfoById(goodsInfo.getSmallCateId());
    request.setAttribute("goodsInfo",goodsInfo);
    request.setAttribute("bigCateInfo",bigCateInfo);
    request.setAttribute("smallCateInfo",smallCateInfo);
%>
<body>
<div class ="div_title">
    <div class="div_titlename"> <img src="images/san_jiao.gif" ><span>商品详情</span></div>
</div>
<table class="edit_table">
    <tr>
        <td class="td_info">商品名称：</td>
        <td>
            <label class="td_input">${goodsInfo.goodsName}</label>
        </td>
    </tr>
    <tr>
        <td class="td_info">商品一级分类：</td>
        <td>
            <label class="td_input">${bigCateInfo.cateName}</label>
        </td>
    </tr>
    <tr>
        <td class="td_info">商品二级分类：</td>
        <td>
            <label class="td_input">${smallCateInfo.cateName}</label>
        </td>
    </tr>
    <tr>
        <td class="td_info">价格：</td>
        <td>
            <label class="td_input">${goodsInfo.price}</label>
        </td>
    </tr>
    <tr>
        <td class="td_info">商品描述：</td>
        <td>
            <label class="td_input">${goodsInfo.des}</label>
        </td>
    </tr>
    <tr>
        <td class="td_info">计量单位：</td>
        <td>
            <label class="td_input">${goodsInfo.unit}</label>
        </td>
    </tr>
    <tr>
        <td class="td_info">生产商：</td>
        <td>
            <label class="td_input">${goodsInfo.producter}</label>
        </td>
    </tr>
    <tr>
        <td class="td_info">编辑日期：</td>
        <td>
            <label class="td_input">${goodsInfo.editDate}</label>
        </td>
    </tr>
    <tr>
        <td class="td_info">商品图片</td>
        <td>
            <img id="preview" src="GoodsServlet.do?flag=showPicture&goodsId=${goodsInfo.id}">
        </td>
    </tr>
    <tr>
        <td class="td_info"></td>
        <td>
            <button class="form_btn" onclick="window.history.back()" >返回 </button>
        </td>
    </tr>
</table>
</body>
</html>
